package client

import (
	"context"
	"github.com/golang/protobuf/ptypes/wrappers"
	"github.com/micro/go-micro/v2"
	"kop/framework/test"
	"kop/modules/configuration/pb"
)

var srv pb.ConfigurationService

func init() {

	var s = micro.NewService()
	s.Init(test.Flags()...)

	var c = s.Client()
	//service.Init(test.Flags()...)

	srv = pb.NewConfigurationService("go.micro.srv.configuration", c)
}

func Load(name string) []byte {

	var b, err = srv.Load(context.TODO(), &wrappers.StringValue{Value: name})
	if err != nil {
		panic(err)
	}

	return b.Value
}
